//
//  MoodViewController.m
//  SunXi
//
//  Created by dllo on 15/11/30.
//  Copyright © 2015年 大远. All rights reserved.
//

#import "MoodViewController.h"

@interface MoodViewController ()<UITableViewDataSource, UITableViewDelegate>

@property(nonatomic, retain) UITableView *tableView;
@property(nonatomic, retain) NSMutableArray *arr;

@end

@implementation MoodViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.arr = [NSMutableArray arrayWithObjects:@"我的心情", @"音心情", @"写心情",nil];

    UIImageView *imageview = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"drawBackPic.jpg"]];
    [self.view addSubview:imageview];
    [imageview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(SV).with.insets(UIEdgeInsetsMake(0, 0, 0, 0));
    }];
    
    
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, (HEIGHT - 64 ) / 3, WIDTH, HEIGHT / 3) style:UITableViewStylePlain];
    [SV addSubview:self.tableView];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.backgroundColor = [UIColor colorWithRed:1 green:1 blue:1 alpha:.5];
    // 横杆
    self.tableView.separatorStyle = NO;
    // 回弹
    self.tableView.scrollEnabled = NO;
   
    
}


- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return self.tableView.frame.size.height / self.arr.count;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.arr.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *reuse = @"reuse";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuse];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:reuse];
        
    }
    cell.backgroundColor = [UIColor clearColor];
    cell.textLabel.text = self.arr[indexPath.row];
    //cell选中的颜色
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.row == 0) {
        
        MyMoodViewController *myMoodVC = [[MyMoodViewController alloc] init];
        
        [self.navigationController pushViewController:myMoodVC animated:YES];
        
    }
    if (indexPath.row == 1) {
        
        SoundMoodViewController *smVC = [[SoundMoodViewController alloc] init];
        [self.navigationController pushViewController:smVC animated:YES];
    }
    
    if (indexPath.row == 2) {
        WriteMoodViewController *wmVC = [[WriteMoodViewController alloc] init];
        [self.navigationController pushViewController:wmVC animated:YES];
    }
    
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
